<!--
 * @Description: 
 * @Autor: zhangbing
 * @Date: 2021-07-28 13:23:51
 * @LastEditors: zhangbing
 * @LastEditTime: 2021-07-28 14:04:59
-->
<template>
  <button :class="['radio-btn', {'current': index == curIdx}]" @click="radioCheck(index)">{{ item }}</button>
</template>

<script>
export default {
  name: 'RadioBtn',
  props: {
    item: String,
    index: Number,
    curIdx: Number,
  },
  data() {
    return {};
  },
  created() {},
  mounted() {},
  methods: {
    radioCheck(index) {
      console.log(index);
      this.$emit('radioCheck', index)
    }
  },
};
</script>

<style>
.radio-btn {
  height: 34px;
  border: none;
  outline: none;
  padding: 0 15px;
  margin-right: 20px;
  border-radius: 5px;
  border: 1px solid #ddd;
  color: #999;
  background-color: #eee;
}

.radio-btn.current {
  background-color: #fff;
  color: red;
  border-color: red;
}
</style>

